<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://www.zkingsoft.com" prefix="matrix"%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!-- 本框架基本脚本和样式 -->
<script type="text/javascript"
	src="${path }/resource/js/plugin/jquery-2.1.4.min.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/systools/MBase.js"></script>
<!-- 文件上传需要的样式 -->

<link rel="stylesheet" type="text/css"
	href="${path }/resource/plugin/kindeditor/themes/default/default.css" />
<link rel="stylesheet" type="text/css"
	href="${path }/resource/plugin/kindeditor/plugins/code/prettify.css" />
<script type="text/javascript"
	src="${path }/resource/plugin/kindeditor/kindeditor.js"></script>
<script type="text/javascript"
	src="${path }/resource/plugin/kindeditor/lang/zh_CN.js"></script>
<script type="text/javascript"
	src="${path }/resource/plugin/kindeditor/plugins/code/prettify.js"></script>

</head>
<body style="height: 100%; overflow: hidden;">
	<div class="ibox-content">
		<form class="form-horizontal " id="dataform"
			onsubmit="javascripr:return false;">
			<%-- <c:if test="${obj ne null }">
				<input type="hidden" name="id" value="${obj.id }">
			</c:if> --%>
			<div class="form-group">
				<label class="col-offset-1 col-sm-2 control-label">父级文章类型</label>
				<div class="col-sm-3">
					<select class="select2 form-control " size="1" name="artTypeParentId"
						id="parentId">
						<option value="0" selected="selected">一级文章类别</option>
					</select>
				</div>
				<label class="col-sm-2 control-label">文章类型名称<span class="text-danger">*</span></label>
				<div class="col-sm-3">
					<input name="artTypeName" type="text" class="form-control " nullmsg="文章类型名称不能为空"
						datatype="*1-50" errormsg="文章类型名称长度不能超过50">					
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">文章类型序号<span class="text-danger">*</span></label>
				<div class="col-sm-3">
					<input name="artTypeSort" type="text" class="form-control " nullmsg="文章类型序号不能为空"
						datatype="n1-10" errormsg="文章类型序号不能超过10">					
				</div>
				<div class="Validform_checktip"></div>
				<label class="col-sm-2 control-label">文章类型描述</label>
				<div class="col-sm-3">
					<input name="artTypeDescription" type="text" class="form-control">					
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">文章code<span class="text-danger">*</span></label>
				<div class="col-sm-3">
					<input name="code" type="text" class="form-control " nullmsg="code不能为空"
						datatype="*" errormsg="code不为空">					
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">分类图片</label>
				<div class="col-sm-9">
					<input onclick="MTools.chooesFile('#fileText')"
						class="input-text upload-url radius form-control" type="text"
						id="showFileName" readonly style="width: 30%; display: inline;">
					<a onclick="MTools.chooesFile('#fileText')"
						class="btn btn-primary radius"> <i class="fa fa-cloud-upload"></i>
						浏览文件
					</a> <a id="selectInServices" class="btn btn-primary radius"> <i
						class="fa fa-cloud"></i> 远程图库
					</a>
				</div>
			</div>

			<div class="form-group">
				<div class="col-sm-2 control-label"></div>
				<div class="col-sm-9">
					<input type="hidden" name="artTypeIcon" id="hiddenImg" /> <img style="display: none"
					<c:if test="${obj ne null }">style="display: none" </c:if>
						width="150" id='img_1' />
				</div>
			</div>

			<div class="form-group ">
				<div class="col-12 text-center">
					<a href="javascript:;" onclick="myForm.submit()"
						class="btn btn-success radius"><i class="fa fa-check"></i>保存</a>&nbsp;&nbsp;&nbsp;&nbsp; 
					<button type="button" class="btn btn-danger radius" onclick="MTools.closeForm()" ><i class="fa fa-close"></i>取消</button>
				</div>
			</div>
		</form>
	</div>
	<form class="form form-horizontal" method="post"
			style="display: none;" enctype="multipart/form-data"
			target="blankFrame"
			action="${path }/resource/plugin/kindeditor/upload_json.jsp?dir=image&flag=img_1&hiddenImg=hiddenImg">

			<input id="fileText" type="file" multiple name="file-1"
				onchange="MTools.selectFile('#showFileName','#fileText','#submitBtn')" />
			<input type="submit" id="submitBtn" onclick="MTools.upolad('img_1','file_1')"   />
		</form>

		<iframe src="" name="blankFrame" id="blankFrame"
			style="height: 100px; width: 100px; display: none;"> </iframe>

	
	
	<script type="text/javascript"
	src="${path }/resource/js/systools/MJsBase.js"></script>
	<script type="text/javascript">
	var myForm;
		$(function() {
			$(".select2").select2({'width':'100%'});
			myForm=MForm.initForm({
				invokeUrl:"${path}/admin/webArticleType/addOrModify",
				afterSubmit : function() {
					parent.initFunctionList();
				}
			});
			initFunctionList();
			MUI.openServiceImgSpace(function(url) {
				$("#img_1").attr("src", url).show();
				$("#hiddenImg").val(url);
			}, "#selectInServices");
			
		});

		/**
		 * 初始化文章类型列表
		 */
		function initFunctionList() {
			$.AjaxProxy({a : false,c : false}).invoke("${path}/admin/webArticleType/all", function(loj) {
				$("#parentId").createSelectTree(
						loj.attr("result").rows,
						{	id : "artTypeId",		// 选项的值
							parent : "artTypeParentId",	// 父节点值
							value : "artTypeName",	// 要显示的名称
							append : false,
							//defaultValue : id,
							defaultHtml : '<option value="0" selected="selected">一级文章类别</option>'
						});
				
			});

		}
		
	</script>
</body>
</html>
